package b.i.k.y;

import android.graphics.Rect;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.view.accessibility.AccessibilityNodeInfo.CollectionInfo;
import android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo;
import com.huawei.hms.analytics.core.crypto.AesCipher.AesLen;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/* compiled from: AccessibilityNodeInfoCompat */
public class b {
    public static int d;
    public final AccessibilityNodeInfo a;
    public int b = -1;
    public int c = -1;

    /* compiled from: AccessibilityNodeInfoCompat */
    public static class a {
        public static final a e = new a(16, null);
        public static final a f = new a(4096, null);
        public static final a g = new a(8192, null);
        public static final a h = new a(262144, null);
        public static final a i = new a(524288, null);
        public static final a j = new a(1048576, null);
        public static final a k;
        public static final a l;
        public final Object a;
        public final int b;
        public final Class<? extends b.i.k.y.d.a> c;
        public final d d;

        static {
            AccessibilityAction accessibilityAction;
            AccessibilityAction accessibilityAction2;
            AccessibilityAction accessibilityAction3 = new AccessibilityAction(1, null);
            AccessibilityAction accessibilityAction4 = new AccessibilityAction(2, null);
            accessibilityAction4 = new AccessibilityAction(4, null);
            accessibilityAction4 = new AccessibilityAction(8, null);
            accessibilityAction4 = new AccessibilityAction(32, null);
            accessibilityAction4 = new AccessibilityAction(64, null);
            accessibilityAction4 = new AccessibilityAction(AesLen.ROOTKEY_COMPONET_LEN, null);
            accessibilityAction4 = new AccessibilityAction(256, null);
            accessibilityAction4 = new AccessibilityAction(512, null);
            accessibilityAction4 = new AccessibilityAction(1024, null);
            accessibilityAction4 = new AccessibilityAction(2048, null);
            accessibilityAction4 = new AccessibilityAction(16384, null);
            accessibilityAction4 = new AccessibilityAction(32768, null);
            accessibilityAction4 = new AccessibilityAction(65536, null);
            accessibilityAction4 = new AccessibilityAction(131072, null);
            accessibilityAction4 = new AccessibilityAction(2097152, null);
            int i = VERSION.SDK_INT;
            if ((i >= 23 ? AccessibilityAction.ACTION_SHOW_ON_SCREEN : null) == null) {
                accessibilityAction = new AccessibilityAction(16908342, null);
            }
            if ((i >= 23 ? AccessibilityAction.ACTION_SCROLL_TO_POSITION : null) == null) {
                accessibilityAction = new AccessibilityAction(16908343, null);
            }
            k = new a(i >= 23 ? AccessibilityAction.ACTION_SCROLL_UP : null, 16908344, null, null, null);
            if ((i >= 23 ? AccessibilityAction.ACTION_SCROLL_LEFT : null) == null) {
                accessibilityAction = new AccessibilityAction(16908345, null);
            }
            l = new a(i >= 23 ? AccessibilityAction.ACTION_SCROLL_DOWN : null, 16908346, null, null, null);
            if ((i >= 23 ? AccessibilityAction.ACTION_SCROLL_RIGHT : null) == null) {
                accessibilityAction = new AccessibilityAction(16908347, null);
            }
            if ((i >= 29 ? AccessibilityAction.ACTION_PAGE_UP : null) == null) {
                accessibilityAction2 = new AccessibilityAction(16908358, null);
            }
            if ((i >= 29 ? AccessibilityAction.ACTION_PAGE_DOWN : null) == null) {
                accessibilityAction2 = new AccessibilityAction(16908359, null);
            }
            if ((i >= 29 ? AccessibilityAction.ACTION_PAGE_LEFT : null) == null) {
                accessibilityAction2 = new AccessibilityAction(16908360, null);
            }
            if ((i >= 29 ? AccessibilityAction.ACTION_PAGE_RIGHT : null) == null) {
                accessibilityAction = new AccessibilityAction(16908361, null);
            }
            if ((i >= 23 ? AccessibilityAction.ACTION_CONTEXT_CLICK : null) == null) {
                accessibilityAction4 = new AccessibilityAction(16908348, null);
            }
            if ((i >= 24 ? AccessibilityAction.ACTION_SET_PROGRESS : null) == null) {
                accessibilityAction4 = new AccessibilityAction(16908349, null);
            }
            if ((i >= 26 ? AccessibilityAction.ACTION_MOVE_WINDOW : null) == null) {
                accessibilityAction4 = new AccessibilityAction(16908354, null);
            }
            if ((i >= 28 ? AccessibilityAction.ACTION_SHOW_TOOLTIP : null) == null) {
                accessibilityAction = new AccessibilityAction(16908356, null);
            }
            if ((i >= 28 ? AccessibilityAction.ACTION_HIDE_TOOLTIP : null) == null) {
                accessibilityAction3 = new AccessibilityAction(16908357, null);
            }
        }

        public a(int i, CharSequence charSequence) {
            this(null, i, null, null, null);
        }

        public int a() {
            return ((AccessibilityAction) this.a).getId();
        }

        public boolean equals(Object obj) {
            if (obj == null || !(obj instanceof a)) {
                return false;
            }
            a aVar = (a) obj;
            Object obj2 = this.a;
            if (obj2 == null) {
                if (aVar.a != null) {
                    return false;
                }
            } else if (!obj2.equals(aVar.a)) {
                return false;
            }
            return true;
        }

        public int hashCode() {
            Object obj = this.a;
            return obj != null ? obj.hashCode() : 0;
        }

        public a(Object obj, int i, CharSequence charSequence, d dVar, Class<? extends b.i.k.y.d.a> cls) {
            this.b = i;
            this.d = dVar;
            if (obj == null) {
                this.a = new AccessibilityAction(i, charSequence);
            } else {
                this.a = obj;
            }
            this.c = cls;
        }
    }

    /* compiled from: AccessibilityNodeInfoCompat */
    public static class b {
        public final Object a;

        public b(Object obj) {
            this.a = obj;
        }

        public static b a(int i, int i2, boolean z, int i3) {
            return new b(CollectionInfo.obtain(i, i2, z, i3));
        }
    }

    /* compiled from: AccessibilityNodeInfoCompat */
    public static class c {
        public final Object a;

        public c(Object obj) {
            this.a = obj;
        }

        public static c a(int i, int i2, int i3, int i4, boolean z, boolean z2) {
            return new c(CollectionItemInfo.obtain(i, i2, i3, i4, z, z2));
        }
    }

    public b(AccessibilityNodeInfo accessibilityNodeInfo) {
        this.a = accessibilityNodeInfo;
    }

    public static String c(int i) {
        if (i == 1) {
            return "ACTION_FOCUS";
        }
        if (i == 2) {
            return "ACTION_CLEAR_FOCUS";
        }
        switch (i) {
            case 4:
                return "ACTION_SELECT";
            case 8:
                return "ACTION_CLEAR_SELECTION";
            case 16:
                return "ACTION_CLICK";
            case 32:
                return "ACTION_LONG_CLICK";
            case 64:
                return "ACTION_ACCESSIBILITY_FOCUS";
            case AesLen.ROOTKEY_COMPONET_LEN /*128*/:
                return "ACTION_CLEAR_ACCESSIBILITY_FOCUS";
            case 256:
                return "ACTION_NEXT_AT_MOVEMENT_GRANULARITY";
            case 512:
                return "ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY";
            case 1024:
                return "ACTION_NEXT_HTML_ELEMENT";
            case 2048:
                return "ACTION_PREVIOUS_HTML_ELEMENT";
            case 4096:
                return "ACTION_SCROLL_FORWARD";
            case 8192:
                return "ACTION_SCROLL_BACKWARD";
            case 16384:
                return "ACTION_COPY";
            case 32768:
                return "ACTION_PASTE";
            case 65536:
                return "ACTION_CUT";
            case 131072:
                return "ACTION_SET_SELECTION";
            case 262144:
                return "ACTION_EXPAND";
            case 524288:
                return "ACTION_COLLAPSE";
            case 2097152:
                return "ACTION_SET_TEXT";
            case 16908354:
                return "ACTION_MOVE_WINDOW";
            default:
                switch (i) {
                    case 16908342:
                        return "ACTION_SHOW_ON_SCREEN";
                    case 16908343:
                        return "ACTION_SCROLL_TO_POSITION";
                    case 16908344:
                        return "ACTION_SCROLL_UP";
                    case 16908345:
                        return "ACTION_SCROLL_LEFT";
                    case 16908346:
                        return "ACTION_SCROLL_DOWN";
                    case 16908347:
                        return "ACTION_SCROLL_RIGHT";
                    case 16908348:
                        return "ACTION_CONTEXT_CLICK";
                    case 16908349:
                        return "ACTION_SET_PROGRESS";
                    default:
                        switch (i) {
                            case 16908356:
                                return "ACTION_SHOW_TOOLTIP";
                            case 16908357:
                                return "ACTION_HIDE_TOOLTIP";
                            case 16908358:
                                return "ACTION_PAGE_UP";
                            case 16908359:
                                return "ACTION_PAGE_DOWN";
                            case 16908360:
                                return "ACTION_PAGE_LEFT";
                            case 16908361:
                                return "ACTION_PAGE_RIGHT";
                            default:
                                return "ACTION_UNKNOWN";
                        }
                }
        }
    }

    public static ClickableSpan[] d(CharSequence charSequence) {
        return charSequence instanceof Spanned ? (ClickableSpan[]) ((Spanned) charSequence).getSpans(0, charSequence.length(), ClickableSpan.class) : null;
    }

    public void a(a aVar) {
        this.a.addAction((AccessibilityAction) aVar.a);
    }

    public final List<Integer> b(String str) {
        List<Integer> integerArrayList = this.a.getExtras().getIntegerArrayList(str);
        if (integerArrayList != null) {
            return integerArrayList;
        }
        ArrayList arrayList = new ArrayList();
        this.a.getExtras().putIntegerArrayList(str, arrayList);
        return arrayList;
    }

    public CharSequence e() {
        return this.a.getContentDescription();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof b)) {
            return false;
        }
        b bVar = (b) obj;
        AccessibilityNodeInfo accessibilityNodeInfo = this.a;
        if (accessibilityNodeInfo == null) {
            if (bVar.a != null) {
                return false;
            }
        } else if (!accessibilityNodeInfo.equals(bVar.a)) {
            return false;
        }
        return this.c == bVar.c && this.b == bVar.b;
    }

    public Bundle f() {
        return this.a.getExtras();
    }

    public CharSequence g() {
        String str = "androidx.view.accessibility.AccessibilityNodeInfoCompat.SPANS_START_KEY";
        if ((b(str).isEmpty() ^ 1) == 0) {
            return this.a.getText();
        }
        List b = b(str);
        List b2 = b("androidx.view.accessibility.AccessibilityNodeInfoCompat.SPANS_END_KEY");
        List b3 = b("androidx.view.accessibility.AccessibilityNodeInfoCompat.SPANS_FLAGS_KEY");
        List b4 = b("androidx.view.accessibility.AccessibilityNodeInfoCompat.SPANS_ID_KEY");
        int i = 0;
        SpannableString spannableString = new SpannableString(TextUtils.substring(this.a.getText(), 0, this.a.getText().length()));
        while (i < b.size()) {
            spannableString.setSpan(new a(((Integer) b4.get(i)).intValue(), this, f().getInt("androidx.view.accessibility.AccessibilityNodeInfoCompat.SPANS_ACTION_ID_KEY")), ((Integer) b.get(i)).intValue(), ((Integer) b2.get(i)).intValue(), ((Integer) b3.get(i)).intValue());
            i++;
        }
        return spannableString;
    }

    public final void h(int i, boolean z) {
        Bundle f = f();
        if (f != null) {
            String str = "androidx.view.accessibility.AccessibilityNodeInfoCompat.BOOLEAN_PROPERTY_KEY";
            int i2 = f.getInt(str, 0) & (~i);
            if (!z) {
                i = 0;
            }
            f.putInt(str, i | i2);
        }
    }

    public int hashCode() {
        AccessibilityNodeInfo accessibilityNodeInfo = this.a;
        return accessibilityNodeInfo == null ? 0 : accessibilityNodeInfo.hashCode();
    }

    public void i(Object obj) {
        CollectionInfo collectionInfo;
        AccessibilityNodeInfo accessibilityNodeInfo = this.a;
        if (obj == null) {
            collectionInfo = null;
        } else {
            collectionInfo = (CollectionInfo) ((b) obj).a;
        }
        accessibilityNodeInfo.setCollectionInfo(collectionInfo);
    }

    public void j(Object obj) {
        this.a.setCollectionItemInfo((CollectionItemInfo) ((c) obj).a);
    }

    public void k(CharSequence charSequence) {
        if (VERSION.SDK_INT >= 26) {
            this.a.setHintText(charSequence);
        } else {
            this.a.getExtras().putCharSequence("androidx.view.accessibility.AccessibilityNodeInfoCompat.HINT_TEXT_KEY", charSequence);
        }
    }

    public String toString() {
        List arrayList;
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(super.toString());
        Rect rect = new Rect();
        this.a.getBoundsInParent(rect);
        StringBuilder stringBuilder2 = new StringBuilder();
        stringBuilder2.append("; boundsInParent: ");
        stringBuilder2.append(rect);
        stringBuilder.append(stringBuilder2.toString());
        this.a.getBoundsInScreen(rect);
        stringBuilder2 = new StringBuilder();
        stringBuilder2.append("; boundsInScreen: ");
        stringBuilder2.append(rect);
        stringBuilder.append(stringBuilder2.toString());
        stringBuilder.append("; packageName: ");
        stringBuilder.append(this.a.getPackageName());
        stringBuilder.append("; className: ");
        stringBuilder.append(this.a.getClassName());
        stringBuilder.append("; text: ");
        stringBuilder.append(g());
        stringBuilder.append("; contentDescription: ");
        stringBuilder.append(e());
        stringBuilder.append("; viewId: ");
        stringBuilder.append(this.a.getViewIdResourceName());
        stringBuilder.append("; checkable: ");
        stringBuilder.append(this.a.isCheckable());
        stringBuilder.append("; checked: ");
        stringBuilder.append(this.a.isChecked());
        stringBuilder.append("; focusable: ");
        stringBuilder.append(this.a.isFocusable());
        stringBuilder.append("; focused: ");
        stringBuilder.append(this.a.isFocused());
        stringBuilder.append("; selected: ");
        stringBuilder.append(this.a.isSelected());
        stringBuilder.append("; clickable: ");
        stringBuilder.append(this.a.isClickable());
        stringBuilder.append("; longClickable: ");
        stringBuilder.append(this.a.isLongClickable());
        stringBuilder.append("; enabled: ");
        stringBuilder.append(this.a.isEnabled());
        stringBuilder.append("; password: ");
        stringBuilder.append(this.a.isPassword());
        StringBuilder stringBuilder3 = new StringBuilder();
        stringBuilder3.append("; scrollable: ");
        stringBuilder3.append(this.a.isScrollable());
        stringBuilder.append(stringBuilder3.toString());
        stringBuilder.append("; [");
        List actionList = this.a.getActionList();
        int i = 0;
        if (actionList != null) {
            arrayList = new ArrayList();
            int size = actionList.size();
            for (int i2 = 0; i2 < size; i2++) {
                arrayList.add(new a(actionList.get(i2), 0, null, null, null));
            }
        } else {
            arrayList = Collections.emptyList();
        }
        while (i < arrayList.size()) {
            a aVar = (a) arrayList.get(i);
            String c = c(aVar.a());
            if (c.equals("ACTION_UNKNOWN") && ((AccessibilityAction) aVar.a).getLabel() != null) {
                c = ((AccessibilityAction) aVar.a).getLabel().toString();
            }
            stringBuilder.append(c);
            if (i != arrayList.size() - 1) {
                stringBuilder.append(", ");
            }
            i++;
        }
        stringBuilder.append("]");
        return stringBuilder.toString();
    }
}
